<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
  <meta base="/mb/">
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />

  <META HTTP-EQUIV="pragma" CONTENT="no-cache">
  <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
  <META HTTP-EQUIV="expires" CONTENT="0">

  <meta name="viewport"
    content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
  <meta name="PUBLISHDATE" content="<%= publistDate %>">
  <!-- <script src="https://kaikingg.gitee.io/pmp-answer-data/config1.js"></script> -->
  <title>PMP答题统计</title>


  <script>
    var _hmt = _hmt || [];
    (function () {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?43d4637873418e818ac4a7d16f735468";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>



  <style>
    iframe {
      display: none;
    }
  </style>
  <script>

    // 每次刷新都加参数，避免缓存
    var gExistData = {}
    // debugger
    var randomNum = Math.random()
    window.prefixUrl = 'https://kaikingg.gitee.io/pmp-answer-data' // 从另一个项目去取数据，把数据和前端分开
    // window.prefixUrl = '.'
    loadScript(window.prefixUrl + '/config.js?timers=' + randomNum, 'config', function () {
      // debugger
      loadScript('./init-data.js?timers=' + randomNum, 'initDta', function () {

      })
    })
    // loadScript('./config.js?timers=' + randomNum, 'config', function () {
    //   // debugger
    //   loadScript('./init-data.js?timers=' + randomNum, 'initDta', function () {

    //   })
    // })

    // 动态加载js数据
    function loadScript (src, date, callback) {
      const head = document.getElementsByTagName('head')[0]
      var scriptDom = ''
      // debugger
      if (gExistData[date]) { // 存在，则剔除
        // debugger
        // head.removeChild(gExistData[date].dom)
        // scriptDom = document.createElement('script') // 位置不能动，需要重新加载数据
        callback()
        return
      } else {
        scriptDom = document.createElement('script') // 位置不能动，需要重新加载数据
        gExistData[date] = {
          dom: scriptDom,
          date: date
        }
      }
      // debugger
      scriptDom.type = 'text/javascript'
      scriptDom.charset = 'UTF-8'
      scriptDom.setAttribute('defer', true)
      // scriptDom.src = src + '?times=' + Math.random()
      scriptDom.src = src
      // debugger
      if (scriptDom.addEventListener) {
        scriptDom.addEventListener('load', function () {
          // debugger
          callback({ date: date })
        }, false)
      } else if (scriptDom.attachEvent) {
        scriptDom.attachEvent('onreadystatechange', function () {
          const target = window.event.srcElement
          if (target.readyState === 'loaded') {
            // debugger
            callback({ date: date })
          }
        })
      }

      head.appendChild(scriptDom)
    }

  </script>
</head>

<body>
  <div id="app"></div>
  <!-- built files will be auto injected -->

  <iframe src="" id="iframeDom" frameborder="0" style="display: none;"></iframe>

</body>


</html>